Get Value of Photoelectric Sensor
Function:
magician.get_infrared_sensor(port)Description: get value of photoelectric sensor
Required parameter:
- port: connect photoelectric sensor to the port of Magician, range: 1, 2, 4, 5. Port 1, port 2, port 4 and port 5 correspond to GP1, GP2, GP4 and GP5 on Magician respectively.
- Return:
- 0: the photoelectric sensor has not detected any object
- 1: the photoelectric sensor has detected object
Example
magician.get_infrared_sensor(port=1)Connect photoelectric sensor to port 1 of Magician. Get the value of photoelectric sensor.